//----BEGIN LICENSE----//
/*****************************************************************\
** prevalentLite - sqlite3 persistence object library 
**
** Copyright (C) 2008 Philip R. Schuchardt
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
**
*****************************************************************/
//----END LICENSE----//

//! \file plInt.h

/*-------------------------------------------------------------------------------------------------
        plInt is a database aware int.  It caches a int
	in memory.  When the int is assigned updates the database
	automatically.
	
	By: Philip Schuchardt - 2008-10-26
---------------------------------------------------------------------------------------------------*/

#ifndef plINT_H
#define plINT_H

//Our includes
#include "plData.h"

class plInt : public plData {

	public:
	//Constructor
        plInt();
	
	//Constructor
        plInt(int value);
	
	//Copy constructor
        plInt(const plInt& obj);
	
        virtual ~plInt() { }

	//Accessor
	int Data();
	
	//Modifier
	void SetData(int value);
	
	//Operator overloading
	void operator=(int value);
	
	//Operator overloading
        void operator=(const plInt& obj);
	
	operator int();
	
	//Binds the data with the statement
	virtual void Bind(sqlite3_stmt* statement, int index = 1) const;
	
	//Gets the data from the current statement
	virtual void Column(sqlite3_stmt* statement, int index = 0);
	
	//The classes name
        static const char* GetClassName() { return "plInt"; }
	
private:	
	int Value;

	//Does a smart copy of the object
        void Copy(const plInt& obj);
	
};



#endif //plINT_H

